<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
<meta name="format-detection" content="telephone=no">
<meta name="HandheldFriendly" content="true" />  
{php include $this->template('shoucecss');}
<style type="text/css">
.header { width: 100%; height: 50px; line-height: 50px; position: fixed; z-index: 1000; top: 0; left: 0; box-shadow: 0 0 2px 0px rgba(0,0,0,0.3),0 0 6px 2px rgba(0,0,0,0.15); }
.header .l { width: 50px; height: 50px; line-height: 50px; color: white; position: absolute; left: 0; top: 0; } 
.header .m { width: 100%; height: 50px; line-height: 50px; text-align: center; color: white; font-size: 18px; } 
.header .r { width: 50px; height: 50px; line-height: 50px; position: absolute; right: 0; top: 0; } 
.mainColor { background: #14c682 !important; } 
.header .l a { font-size: 18px; color: white; display: block; width: 100%; height: 100%; text-align: center; }
body {background-color: #E7FAFF;}
.feedback_title_box {position: relative;border: none;height: 36px;line-height: 16px;padding: 10px;box-sizing: border-box;width: 100%;border-radius: 5px;background-color: #F2F2F2;border: 1px solid #ddd;}
.feedback_title.feedback_title_teacher { background: url({OSSURL}public/mobile/img/select_down_icon2.png) no-repeat right center;background-size: 16px;-webkit-appearance: none;width: 100%;padding-right: 20px;box-sizing: border-box;border: none;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;}
</style>
<script type="text/javascript" src="{MODULE_URL}public/mobile/js/jquery-1.11.3.min.js?v=4.8"></script>
{php include $this->template('port');}
<title>{$school['title']}</title>
</head>
<body>
<div class="All">
<div class="header mainColor">
	<div class="l">
		<a class="backOff" style="background:url({OSSURL}public/mobile/img/ic_arrow_left_48px_white.svg) no-repeat;background-size: 55% 55%;background-position: 50%;" href="javascript:history.go(-1);"></a>
	</div>
	<div class="m">
		<a><span style="font-size: 18px">新建</span></a>
	</div>
</div>
<div class="top_height_blank"></div>
<div class=" manual_list">

    <div class="manual_main_box">
        <div class="title_l">创建{$school['shoucename']}</div>
        <div class="blank"></div>
        <div class="input_text_1">
            <input id="manual_title" type="text" placeholder="请输入标题...">
        </div>
		<div class="blank"></div>
		<div class="feedback_title_box">
			<select class="feedback_title feedback_title_teacher" id="bj_id">
				<option value="">请选择关联班级</option>
			{loop $allbj $row}
				{if $row['sid'] !=$teacher['bj_id1'] && $row['sid'] !=$teacher['bj_id2'] && $row['sid'] !=$teacher['bj_id3']}			
				<option value="{$row['sid']}">{$row['sname']}</option>
				{/if}
			{/loop}	
				{if $bj1}<option value="{$bj1['sid']}">{$bj1['sname']}</option>{/if}
				{if $bj2}<option value="{$bj2['sid']}">{$bj2['sname']}</option>{/if}
				{if $bj3}<option value="{$bj3['sid']}">{$bj3['sname']}</option>{/if}			
			</select>
		</div>
		<div class="blank"></div>
		<div class="feedback_title_box">
			<select class="feedback_title feedback_title_teacher" id="qh_id">
				<option value="">请选择关联期号</option>
				{loop $allqh $row}			
				<option value="{$row['sid']}">{$row['sname']}</option>
				{/loop}				
			</select>
		</div>
		<div class="blank"></div>
		<div class="feedback_title_box">
			<select class="feedback_title feedback_title_teacher" id="kc_id">
				<option value="">请选择课程</option>
				{loop $allkc $row}			
				<option value="{$row['id']}">{$row['name']}</option>
				{/loop}				
			</select>
		</div>
        <div class="blank"></div>
        <div class="input_text_1 start_time">
            <input id="start_time" type="date" value="" placeholder="开始时间...">
        </div>
        <div class="blank"></div>
        <div class="input_text_1 end_time">
            <input id="end_time" type="date" value="" placeholder="结束时间...">
        </div>
        <div class="blank"></div>
        <div class="small_notice">选择评价规则</div>
        <div class="select_cover_img">
			{loop $allscset $row}
                <div setid="{$row['id']}" class="select_cover_li{if $row['ssort'] ==1} on{/if}" style="background-image: url({php echo tomedia($row['icon'])})"><p style="font-size:10px;">{$row['title']}</p></div>
			{/loop}
        </div>
        <div class="blank"></div>
        <div class="blue_add_btn">创建</div>
    </div>
</div>

        <div class="clear"></div>
    </div>

</body>
</html>
<script>
	$(function () {

		//========选择图片======//
		$(".select_cover_li").on("click", function () {
			$(this).addClass("on").siblings(".select_cover_li").removeClass("on");
		})

		$('.blue_add_btn').on('click', function () {
			var title = $.trim($('#manual_title').val());
			var start_time = $('#start_time').val();
			var end_time = $('#end_time').val();
			var bj_id = $('#bj_id').val();
			var kc_id = $('#kc_id').val();
			var qh_id = $('#qh_id').val();
			var setid = $('.select_cover_img').find('.on').attr('setid');

			if (title == '') {
				jTips('标题不能为空');
				return;
			}

			// 2.敏感词检查
			var sensitive_words = "非法|不合法|三聚氰胺|色情|法轮功|涉黄|吸毒|邪教|台独|藏独|伊斯兰教|鸡巴|妓女|枪毙|强暴|艾滋病|性交|3P|恐怖分子|自慰|约炮|肛交|毒品|";
			var filter = sensitive_words.split('|');
			for (var i = 0; i < filter.length; i++) {
				var filter_word = filter[i].trim();

				if (filter_word == "")
					continue;

				if (title.indexOf(filter_word) > -1) {
					jTips("请遵守国家法律法规，请勿发布暴力、谣言、色情等言论。手册标题含有非法词语：" + filter_word);
					return;
				}
			}

			if (start_time == '') {
				jTips('开始时间不能为空', function () {
					return;
				});
			} else if (end_time == '') {
				jTips('结束时间不能为空', function () {
					return;
				});
			} else if (bj_id == '') {
				jTips('必须选择关联班级', function () {
					return;
				});				
			} else if (start_time >= end_time) {
				jTips('开始时间必须小于结束时间', function () {
					return;
				});
			} else {
				//创建联系手册

				title = iphone_emoji_filter(title);

				$.ajax({
					url: "{php echo $this->createMobileUrl('shouceadd', array('schoolid' => $schoolid,'op' => 'add'), true)}",
					data: { 'title': title,'tid': "{$it['tid']}", 'setid': setid, 'bj_id': bj_id, 'qh_id': qh_id, 'kc_id': kc_id, 'starttime': start_time, 'endtime': end_time},
					dataType: 'json',
					type: 'post',
					success: function (data) {
						jTips(data.info, function () {
							if (data.status == 1) {
								location.href = "{php echo $this->createMobileUrl('shoucelist', array('schoolid' => $schoolid), true)}";
							}
						});
					},
				});
			}
		});
	})

</script>
